class Solution {
    public void duplicateZeros(int[] arr) {
         int cur = 0; 
         int dest = -1 ;
         while(cur < arr.length && dest < arr.length-1){
          if(arr[cur] != 0){
            dest ++;
          }else{
            dest += 2 ;
          }
          if(dest >= arr.length-1){
            break ;
          }
          cur ++;
         }
         while(cur >= 0 && dest >= 0){
            if(arr[cur] == 0 && dest == arr.length){
                arr[dest-1] = arr[cur];
                dest -= 2 ;
            }else{
               if(arr[cur] != 0){
                arr[dest] = arr[cur];
                dest--;
               }else{
                arr[dest] = arr[cur];
                arr[dest-1] = arr[cur];
                dest -= 2 ;
               }
            }
             cur -- ;
         }



    }
}